--------------------------------------------------------------------------------
      name:  <unnamed>
       log:  E:\Seagate Sync\VOL\Personal folder\Documents\Research\Past project
> s\cbld\Posted\121020 Website\Data analysis\cbld-management04-exp03.log
  log type:  text
 opened on:  21 Oct 2012, 15:41:08

. 
. 
. * ****************************************************************************
> *
. * Processing of results of computational experiment 5 for further data analysi
> s
. * ****************************************************************************
> *
. 
. * Programme:    cbld-management04-exp03.do
. * Project:              Council coalition building
. * Author:               Frank Haege, Department of Politics and Administration
> , University of Limerick
. * Contact:              frank.haege@ul.ie
. 
. * Description
. *************
. * This do-file uses the simulation results of the fifth computational experime
> nt to 
. * generate data sets of predicted consensus rates and consensus rates expected
>  by chance.
. 
. 
. * Set up Stata
. version 11

. clear all

. macro drop _all

. set linesize 80

. set more off

. 
. * Load data set
. use "Experiments\Experiment03\cbld-model-121020-exp03.dta", clear

. 
. * Generate dichotomous consensus variable
. generate consensus = 0

. replace consensus = 1 if noblock == nostates
(27242 real changes made)

. label var consensus "Consensus decision"

. tab consensus, m

  Consensus |
   decision |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      6,758       19.88       19.88
          1 |     27,242       80.12      100.00
------------+-----------------------------------
      Total |     34,000      100.00

. 
. * Generate regime variable
. label var regime "Regime"

. label def regimel /*
>         */ 1 "Member States and Voting Threshold set by slider" /*
>         */ 2 "Pre-1995: 12 Member States, pre-Nice Rules" /*
>         */ 3 "1995-2003: 15 Member States, pre-Nice Rules" /*
>         */ 4 "2005-2006: 25 Member States, Nice Rules (votes)" /*
>         */ 5 "2005-2006: 25 Member States, Nice Rules (votes & population)" /*
>         */ 6 "2005-2006: 25 Member States, Nice Rules (votes & population & st
> ates)" /*
>         */ 7 "2005-2006: 25 Member States, Nice Rules (population)" /*
>         */ 8 "2005-2006: 25 Member States, Nice Rules (population & votes)" /*
>         */ 9 "2005-2006: 25 Member States, Nice Rules (population & votes & st
> ates)" /*
>         */ 10 "2007-2013: 27 Member States, Nice Rules (votes)" /*
>         */ 11 "2007-2013: 27 Member States, Nice Rules (votes & population)" /
> *
>         */ 12 "2007-2013: 27 Member States, Nice Rules (votes & population & s
> tates)" /*
>         */ 13 "2007-2013: 27 Member States, Nice Rules (population)" /*
>         */ 14 "2007-2013: 27 Member States, Nice Rules (population & votes)" /
> *
>         */ 15 "2007-2013: 27 Member States, Nice Rules (population & votes & s
> tates)" /*
>         */ 16 "Post-2014: 27 Member States, Lisbon Rules (votes)" /*
>         */ 17 "Post-2014: 27 Member States, Lisbon Rules (votes & states)" /*
>         */ 18 "Post-2014: 27 Member States, Lisbon Rules (votes & states & min
> ority)"

. label val regime regimel

. tab regime, m

                                 Regime |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
Pre-1995: 12 Member States, pre-Nice Ru |      2,000        5.88        5.88
1995-2003: 15 Member States, pre-Nice R |      2,000        5.88       11.76
2005-2006: 25 Member States, Nice Rules |      2,000        5.88       17.65
2005-2006: 25 Member States, Nice Rules |      2,000        5.88       23.53
2005-2006: 25 Member States, Nice Rules |      2,000        5.88       29.41
2005-2006: 25 Member States, Nice Rules |      2,000        5.88       35.29
2005-2006: 25 Member States, Nice Rules |      2,000        5.88       41.18
2005-2006: 25 Member States, Nice Rules |      2,000        5.88       47.06
2007-2013: 27 Member States, Nice Rules |      2,000        5.88       52.94
2007-2013: 27 Member States, Nice Rules |      2,000        5.88       58.82
2007-2013: 27 Member States, Nice Rules |      2,000        5.88       64.71
2007-2013: 27 Member States, Nice Rules |      2,000        5.88       70.59
2007-2013: 27 Member States, Nice Rules |      2,000        5.88       76.47
2007-2013: 27 Member States, Nice Rules |      2,000        5.88       82.35
Post-2014: 27 Member States, Lisbon Rul |      2,000        5.88       88.24
Post-2014: 27 Member States, Lisbon Rul |      2,000        5.88       94.12
Post-2014: 27 Member States, Lisbon Rul |      2,000        5.88      100.00
----------------------------------------+-----------------------------------
                                  Total |     34,000      100.00

. 
. 
. * Generate data sets of predicted consensus rates and consensus rates expected
>  by chance
. ******************************************************************************
> **********
. 
. * Collapse data by combination of move sequence and regime
. sort sequence regime

. collapse (mean) consensus=consensus nostates=nostates, by(sequence regime)

. label var consensus "Expected consensus (model)"

. label var nostates "Number of member states"

. 
. * Generate standard error of proportion
. generate se = sqrt(consensus*(1-consensus)/1000)

. label var se "Standard error (model)"

. 
. * Generate lower and upper bound of confidence interval
. generate lowerci = (consensus - (1.96 * se))

. label var lowerci "CI lower bound (model)"

. generate upperci = (consensus + (1.96 * se))

. label var upperci "CI upper bound (model)"

.         
. * Generate rule-member state period variable
. generate rulemembersize = .
(34 missing values generated)

. replace rulemembersize = 1 if regime == 2
(2 real changes made)

. replace rulemembersize = 2 if regime == 3
(2 real changes made)

. replace rulemembersize = 3 if regime > 3 & regime <= 9
(12 real changes made)

. replace rulemembersize = 4 if regime > 9 & regime <= 15
(12 real changes made)

. replace rulemembersize = 5 if regime > 15
(6 real changes made)

. label var rulemembersize "Rule-membership period"

. label define rulemembersizel /*
>         */ 1 "Pre-Nice 12" /*
>         */ 2 "Pre-Nice 15" /*
>         */ 3 "Nice 25" /*
>         */ 4 "Nice 27" /*
>         */ 5 "Lisbon 27", modify

. label val rulemembersize rulemembersizel

. 
. * Merge with expected consensus rates data
. merge m:1 nostates using "Experiments\Other data\cbld-management02.dta"

    Result                           # of obs.
    -----------------------------------------
    not matched                            18
        from master                        18  (_merge==1)
        from using                          0  (_merge==2)

    matched                                16  (_merge==3)
    -----------------------------------------

. drop _merge

. 
. * Generate dataset based on model with weighted votes and random execution
. sort sequence regime

. preserve

.         * Drop redundant data points
.         keep if regime == 2 | regime == 3 | regime == 4
(28 observations deleted)

.         keep if sequence == 1
(3 observations deleted)

. 
.         * Save data set
.         sort rulemembersize

.         save "Experiments\Experiment03\cbld-management04-exp03a1.dta", replace
file Experiments\Experiment03\cbld-management04-exp03a1.dta saved

. restore

. 
. * Generate dataset based on model with weighted votes and sequence execution
. preserve

.         * Drop redundant data points
.         keep if regime == 2 | regime == 3 | regime == 4
(28 observations deleted)

.         keep if sequence == 2
(3 observations deleted)

. 
.         * Save data set
.         sort rulemembersize

.         save "Experiments\Experiment03\cbld-management04-exp03b1.dta", replace
file Experiments\Experiment03\cbld-management04-exp03b1.dta saved

. restore

. 
. * Generate dataset based on model with weighted votes, population threshold (u
> nder Nice), and random execution
. preserve

.         * Drop redundant data points
.         keep if regime == 2 | regime == 3 | regime == 5
(28 observations deleted)

.         keep if sequence == 1
(3 observations deleted)

. 
.         * Save data set
.         sort rulemembersize

.         save "Experiments\Experiment03\cbld-management04-exp03a2.dta", replace
file Experiments\Experiment03\cbld-management04-exp03a2.dta saved

. restore

. 
. * Generate dataset based on model with weighted votes, population threshold (u
> nder Nice), and sequence execution
. preserve

.         * Drop redundant data points
.         keep if regime == 2 | regime == 3 | regime == 5
(28 observations deleted)

.         keep if sequence == 2
(3 observations deleted)

. 
.         * Save data set
.         sort rulemembersize

.         save "Experiments\Experiment03\cbld-management04-exp03b2.dta", replace
file Experiments\Experiment03\cbld-management04-exp03b2.dta saved

. restore

. 
. * Generate dataset based on model with weighted votes, population and member s
> tate threshold (under Nice), and random execution
. preserve

.         * Drop redundant data points
.         keep if regime == 2 | regime == 3 | regime == 6
(28 observations deleted)

.         keep if sequence == 1
(3 observations deleted)

. 
.         * Save data set
.         sort rulemembersize

.         save "Experiments\Experiment03\cbld-management04-exp03a3.dta", replace
file Experiments\Experiment03\cbld-management04-exp03a3.dta saved

. restore

. 
. * Generate dataset based on model with weighted votes, population and member s
> tate threshold (under Nice), and sequence execution
. preserve

.         * Drop redundant data points
.         keep if regime == 2 | regime == 3 | regime == 6
(28 observations deleted)

.         keep if sequence == 2
(3 observations deleted)

. 
.         * Save data set
.         sort rulemembersize

.         save "Experiments\Experiment03\cbld-management04-exp03b3.dta", replace
file Experiments\Experiment03\cbld-management04-exp03b3.dta saved

. restore

. 
. * Save data set
. sort sequence regime

. compress
nostates was float now byte
rulemembersize was float now byte

. save "Experiments\Experiment03\cbld-management04-exp03.dta", replace
file Experiments\Experiment03\cbld-management04-exp03.dta saved

. 
. 
. * Exit do-file
. log close
      name:  <unnamed>
       log:  E:\Seagate Sync\VOL\Personal folder\Documents\Research\Past project
> s\cbld\Posted\121020 Website\Data analysis\cbld-management04-exp03.log
  log type:  text
 closed on:  21 Oct 2012, 15:41:08
--------------------------------------------------------------------------------
